package com.abc.mapper;

import com.abc.entity.User;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

public interface UserMapper {
    /**
     * 根据用户名查询用户信息
     * @param username 用户名
     * @return User 查询到的用户信息
     */
    @Select("select * from user where username = #{username}")
    @Results(id = "userMap", value = {
            @Result(property = "id", column = "id", javaType = String.class,jdbcType = JdbcType.VARCHAR,id = true),
            @Result(property = "name", column = "name",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "username", column = "username",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "password", column = "password",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "phone", column = "phone",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "gender", column = "gender",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "isEnable", column = "is_enable",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "lastLoginTime", column = "last_login_time",javaType = String.class,jdbcType = JdbcType.VARCHAR)})

    User selectByUsername(String username);
}
